package edu.fim.presentation.controller;

import java.util.List;

import edu.fim.core.exception.ServiceException;
import edu.fim.core.service.FoodService;
import edu.fim.core.service.locator.ServiceLocator;
import edu.fim.presentation.controller.exception.ControllerException;
import edu.fim.presentation.model.bean.Consumer;
import edu.fim.presentation.model.bean.Food;


public class FoodController {

	public List<Food> findAll() throws ControllerException {
		FoodService service = ServiceLocator.getImplementation(FoodService.class);
		try {
			return service.findAll();
		}
		catch (ServiceException e) {
			e.printStackTrace();
			throw new ControllerException(e.getMessage());
		}
	}
	
	public List<Food> findNonPreferences(Consumer consumer) {
		FoodService service = ServiceLocator.getImplementation(FoodService.class);
		return service.findNonPreferences(consumer);
	}
}